﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SimpleServiceBus.Bus.MessageManagement.Serialization;
using SimpleServiceBus.Utilities.ObjectBuilder;

namespace SimpleServiceBus.Bus.MessageManagement.Serialization
{
    public class ConfigureSerialization : IWith
    {
        private bool _xml;
        private bool _binary;

        public static IWith XmlSerializer
        {
            get
            {
                var c = new ConfigureSerialization {_xml = true};

                return c;
            }
        }

        public static IWith BinarySerializer
        {
            get
            {
                var c = new ConfigureSerialization {_binary = true};

                return c;
            }
        }

        public void With(IObjectBuilder objectBuilder)
        {
            //if ((_xml && _binary) || (!_xml && !_binary))
            //    throw new InvalidOperationException("Must define either XML or Binary, not both.");

            //if (_xml)
            //    objectBuilder.ConfigureComponent(typeof(XmlMessageSerializer), ComponentCallModelEnum.Singleton);

            //if (_binary)
            //    objectBuilder.ConfigureComponent(typeof(BinaryMessageSerializer), ComponentCallModelEnum.Singleton);
        }

        private ConfigureSerialization()
        {

        }
    }

    public interface IWith
    {
        void With(IObjectBuilder objectBuilder);
    }
}